package com.cheche.dn.domain;

import com.cheche.dn.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.security.Principal;

/**
 * Controller - Root
 * Created by cheshun on 15/9/2.
 */
@Controller
public class RootController implements Apis {

    @RequestMapping(value = ROOT_URL)
    @ResponseBody
    public Object root(Principal principal) {
        return Result.success(String.format("Welcome! %s", principal != null ? principal.getName() : ""));
    }
}
